#!/bin/sh
# System startup script for nginx 3d-printer host code

### BEGIN INIT INFO
# Provides:          nginx
# Required-Start:    $local_fs
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: nginx daemon
# Description:       Starts the nginx daemon.
### END INIT INFO

function status_msg() {
  echo -e "\n${magenta}## ${1}${white}"
}
case "$1" in
start)  status_msg "启动nginx"
        nginx -s stop
        nginx
        status_msg "nginx启动完成"
        ;;
stop)   status_msg "停止nginx"
        nginx -s stop
        status_msg "已停止nginx"
        ;;
restart) status_msg "重新启动nginx"
        $0 stop
        $0 start
        ;;
esac
exit 0